﻿using System;
using System.Collections.Generic;
using System.Text;
using HtmlParsingLibrary;
using System.IO;
using StockTrader.Stocks.General;

// Broker specific packages
using StockTrader.Broker.IciciDirect;
//using NSEParser;
//using MoneyControlParser;

using System.Xml;
using System.Threading;
using System.Data.SqlClient;
using System.Security.Cryptography;
using HttpLibrary;
using System.Net;
using System.Diagnostics;
using System.Configuration;
using System.Globalization;

namespace StockTrader.Platform.Database
{
    partial class Program_old
    {
        static void Main1(string[] args)
        {
            #region SQLConectionTesting

            //SqlConnectionStringBuilder sb = new SqlConnectionStringBuilder();
            //sb.InitialCatalog = "StockTraderSolution";
            //sb.IntegratedSecurity = true;
            //sb.DataSource = "localhost\\SQLEXPRESS";
            //string connectionString = sb.ConnectionString;
            //string traceString;

            //using (SqlConnection connection = new SqlConnection(connectionString + ";MultipleActiveResultSets=true"))
            //{
            //    connection.Open();
            //    using (SqlCommand cmd = connection.CreateCommand())
            //    {
            //        cmd.CommandText = "SELECT DISTINCT NSECode FROM [dbo].[NSEStockHistory] ORDER BY NSECode";
            //        using (SqlDataReader reader = cmd.ExecuteReader())
            //        {
            //            while (reader.Read())
            //            {
            //                string stockCode = reader.GetString(0);
            //                object[] itemArray = new object[dayCount + 1];
            //                itemArray[0] = stockCode;
            //                using (SqlCommand subCmd = connection.CreateCommand())
            //                {
            //                    subCmd.CommandText = "SELECT TOP " + dayCount + " PercChange FROM [dbo].[NSEStockHistory] WHERE NSECode=@NSECode ORDER BY Date DESC";
            //                    subCmd.Parameters.AddWithValue("@NSECode", stockCode);
            //                    using (SqlDataReader subReader = subCmd.ExecuteReader())
            //                    {
            //                        int i = 1;
            //                        while (subReader.Read())
            //                        {
            //                            itemArray[i++] = subReader[0];
            //                        }
            //                    }
            //                }
            //                rowArrays.Add(itemArray);

            //            }
            //        }
            //    }
            //}
            //rowArrays.Sort(new PercChangeComparer());
            //foreach (object[] singleItemArray in rowArrays)
            //{
            //    table.Rows.Add(singleItemArray);
            //}

            //return table;
            #endregion
        }
    }

}